﻿using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows;
using LFSRecord2.Model;

namespace LFSRecord2.View.Dialogs
{
    /// <summary>
    /// Interaction logic for AboutDialogBox.xaml
    /// </summary>
    public partial class AboutDialogBox : Window
    {
        public AboutDialogBox()
        {
            InitializeComponent();
        }

        private void ReadmeHyperlink_Click(object sender, RoutedEventArgs e)
        {
            //Debug.WriteLine("Path : " + LFSRecordController.StartupDirectory);
            if (File.Exists(LfsRecordController.StartupDirectory + "\\README.txt"))
                System.Diagnostics.Process.Start(LfsRecordController.StartupDirectory + "\\README.txt");
            else
                System.Diagnostics.Process.Start("http://www.lfs.net/LFSRecord/README.txt");
        }

        private void ForumHyperlink_Click(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.lfsforum.net/showthread.php?t=72001");
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            FileVersionInfo info = System.Diagnostics.FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);

            FullNameBox.Text = "LFS Record, version " + info.FileMajorPart + "." + info.FileMinorPart + " Beta";

            FullVersionBox.Text = "("+
                info.FileMajorPart + "." + 
                info.FileMinorPart + "." +
                info.FileBuildPart + "." +
                info.FilePrivatePart + ")";
        }
    }
}
